import { mapState } from 'vuex'

export default {
  data() {
    return {
      /*
      * 分页参数
      *  */
      pageParams: {
        page: 1,
        pageSize: 10,
        truckTypeId: undefined,
        licensePlate: undefined,
        workStatus: undefined
      },
      loading: false
    }
  },
  methods: {
    /*
    *获取车辆分页数据的回调函数
    *  */
    async fetchVehicleList() {
      try {
        this.loading = true
        await this.$store.dispatch('vehicleListStore/fetchVehicleListAction', this.pageParams)
      } catch (error) {
        this.$message.error(error.message)
      } finally {
        this.loading = false
      }
    }
  },
  computed: {
    ...mapState('vehicleListStore', ['vehicleList', 'counts', 'count'])

  },
  mounted() {
    this.fetchVehicleList()
  }
}
